//
// Created by xm on 2024/6/13.
//

#include "test06.h"
#include "iostream"
using namespace std;


int demo01_func1(int a, int b){
    if(b==0){
//        throw "b 不能为 0";
        throw 20.0f;
    }

    return  a/b;
}

static void demo01(){

    int a = 10;
    int b = 0;

    try{
        demo01_func1(a, b);
    }catch(int e){
            cout << "接收一个int类型的异常: " << e << endl;
    }catch (double e){
        cout << "接收一个double类型的异常: " << e << endl;
    }catch (char const* e){
        cout << "接收一个string类型的异常: " << e << endl;
    }catch (...){
        cout << "接收一个其他类型的异常" << endl;
    }
}

void test06(){
    demo01();
}